#Dependencies: In order to successfully build the make file, id3lib and libxml2 needs to be installed on the system
CC = g++
LINKER_FLAGS = -ggdb -lid3 -lz -lsqlite3 -lexif `pkg-config fuse --libs` -L $(INIPARSER_PATH)/ -liniparser -L /usr/local/lib
COMPILE_FLAGS_FUSE = -ggdb `pkg-config fuse --cflags` -fpermissive
COMPILE_FLAGS = -Wall -Wextra -ggdb
INIPARSER_PATH= ~/iniparser-2.17
BINDIR = ~/bin

all:	optimfs

util.o:	util.c
	g++ -c -o util.o util.c $(COMPILE_FLAGS)

id3TagParser.o:	id3TagParser.cpp
	g++ -c -o id3TagParser.o id3TagParser.cpp $(COMPILE_FLAGS_FUSE)

sqliteDataProvider.o:	sqliteDataProvider.c
	g++ -c -o sqliteDataProvider.o sqliteDataProvider.c $(COMPILE_FLAGS_FUSE)

exifTagParser.o:	exifTagParser.c
	g++ -c -o exifTagParser.o exifTagParser.c $(COMPILE_FLAGS_FUSE)

sqliteTester:	sqliteDataProvider.c id3TagParser.cpp sqliteTester.c util.c exifTagParser.c
	g++ sqliteTester.c id3TagParser.cpp sqliteDataProvider.c exifTagParser.c util.c $(LINKER_FLAGS) -o sqliteTester $(COMPILE_FLAGS_FUSE)

configTester:
	g++ configTester.c configReader.c util.c -o configTester -liniparser -L ../iniparser -I ../iniparser/src -D_FILE_OFFSET_BITS=64	

configReader.o:		configReader.c
	g++ -c -o configReader.o configReader.c -I $(INIPARSER_PATH)/src $(COMPILE_FLAGS_FUSE)
customTagParser.o:	customTagParser.c
	g++ -c -o customTagParser.o customTagParser.c $(COMPILE_FLAGS_FUSE)
optimfs.o: id3TagParser.o
	g++ -c -o optimfs.o optimfs.c $(COMPILE_FLAGS_FUSE) -I $(INIPARSER_PATH)/src
	
optimfs: id3TagParser.o util.o exifTagParser.o configReader.o sqliteDataProvider.o customTagParser.o optimfs.o
	g++ id3TagParser.o optimfs.o util.o exifTagParser.o sqliteDataProvider.o configReader.o customTagParser.o $(COMPILE_FLAGS_FUSE) $(LINKER_FLAGS) -o optim

clean:
	rm  -f *.x *.o
